package itcast.web.servlet;

import itcast.service.BuildService;
import itcast.service.BuildmanagerService;
import itcast.service.impl.BuildServiceImpl;
import itcast.service.impl.BuildmanagerServiceimpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/delBuildServlet")
public class DelBuildServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        //1.获取id
        String id=request.getParameter("id");
        //2.调用Service删除
        BuildService service=new BuildServiceImpl();
        service.deleteBuild(id);
        //3.跳转到查询所有的Servlet
        response.sendRedirect(request.getContextPath()+"/buildServlet");

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        this.doPost(request,response);
    }
}
